{include file="public/header" /}
<div class="main">
	<div class="login">
		<div class="logo text-center">
			<a href="javascript:void(0);"><img src="__PUBLIC__/images/logo-219.png" width="220px" height="50px"></a>
		</div>
		<div class="panel panel-default">
			<div class="panel-body">
				<form action="" method="post" role="form" id="form1">
					<div class="form-group input-group">
						<span id="message" class="text-danger"></span>
					</div>
					<div class="form-group input-group">
						<div class="input-group-addon"><img src="__PUBLIC__/images/icon-user.png" alt="" /></div>
						<input name="username" type="text" id='user' class="form-control" placeholder="请输入用户名登录" value="" />
					</div>
					<div class="form-group input-group">
						<div class="input-group-addon"><img src="__PUBLIC__/images/icon-pass.png" alt="" /></div>
						<input name="password" type="password" id='pawd' class="form-control " placeholder="请输入登录密码" value="" />
					</div>
					<!--验证码输入框-->
					<div class="form-group input-group">
						<div class="input-group-addon"><img src="__PUBLIC__/images/icon-pass.png" alt="" /></div>
						<input name="verify" type="text" id='verify' class="form-control " placeholder="请输入验证码" value="" />
					</div>
					<!--验证码显示-->
					<div class="form-group input-group" style="margin: 0 auto;margin-bottom: 30px;">
						<img class="verify_img" id="verify_img" src="{:url('Login/verify')}" onClick="this.src='{:url('Login/verify')}'+'?'+Math.random()" title="点击获取">
					</div>
					
					<div class="login-submit text-center">
						<input type="button" id="submit" name="submit" value="登录" class="btn btn-primary" />
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
</div>
{include file="public/footer" /}
<script>
	$("#submit").click(function(){
		var user = $('#user').val();
		var pawd = $('#pawd').val();
		var verify = $('#verify').val();
		if(user==''){
			util.message('账号不能为空', '', '');
			return false;
		}
		if(pawd==''){
			util.message('密码不能为空', '', '');
			return false;
		}
		if(verify==''){
			util.message('验证码不能为空', '', '');
			return false;
		}
		$.ajax({
	        url: "{:url('Login/login')}",
	        data:{'user':user,'pawd':pawd,'verify':verify},
	        type: "post",
	        dataType: "json",
	        success: function (data) {
	           if(data==1){
	           		location.href="{:url('Index/index')}";
	           }else if(data==2){
	           	util.message('密码错误', '', '');
	           }else if(data==3){
	           	util.message('账号错误', '', '');
	           }else{
	           		util.message('验证码错误', '', '');
	           }
	        }
    	});
	});
</script>
